#include "RedisSubscriber.h"
#include <QDebug>
RedisSubscriber::RedisSubscriber() {}

// void RedisSubscriber::shares(SharedData *share_)
// {
//     share = share_;
// }

void RedisSubscriber::Run()
{

    //subscribe redis topic
    start();
}

void RedisSubscriber::setLoader(QLibrary *)
{

}

void RedisSubscriber::run(){
    QThread::msleep(1000);
    //redis message emit to onData signal.
    while(!isInterruptionRequested()){
        QString usr = "Redis";
        QString key = "key";
        QVariant val = "val";

        //qDebug() << __FILE__ << __FUNCTION__;

        emit pubData(usr, key, val);
        QThread::msleep(1000);
    }
}


Publisher* instance()
{
    return new RedisSubscriber();
}

void destroy(Publisher* pInstance)
{
    if( pInstance )
    {
        delete pInstance;
    }
}

